import React, { Component } from 'react'
import './css/index.css'
export default class Swipper extends Component {
    state = {
        index:4
    }
    render() {
        let {index} = this.state
        return (
            <div className="wrapper">
                <img src={require(`./images/${index}.webp`)} alt="" />
                <span onClick={()=>{
                    index--;
                    if(index <=0 ) index = 4;
                    this.setState({
                        index
                    })
                }}> &lt; </span>
                <span onClick={()=>{
                    index++;
                    if(index >=5 ) index = 1
                    this.setState({
                        index
                    })
                }} className="right"> &gt; </span>
            </div>
        )
    }
}
